package com.mc.string;

public class SwapUpperCase {
	public static void swap(String str){
		StringBuilder sb = new StringBuilder(str);
		int num = 0;
		for(int i=sb.length()-1;i>=0;i--){
			if(sb.charAt(i)<'a'){//找到大写
				char cha = sb.charAt(i);
				int j = i+1;
				num++;
				while(j<sb.length()-num+1){
					sb.setCharAt(j-1, sb.charAt(j));
					j++;
				}
				sb.setCharAt(j-1, cha);
			}
		}
		System.out.println(sb.toString());
	}
	public static void main(String[] args) {
		SwapUpperCase.swap("ABCjdklsjdD");
		
	}
}
